package com.ruoyi.web.controller.shopping.backend;

import com.github.pagehelper.PageInfo;
import com.ruoyi.system.domain.shopping.ShoppingCart;
import com.ruoyi.system.domain.shopping.vo.OrderVo;
import com.ruoyi.system.service.shopping.ShoppingCartService;
import com.ruoyi.system.view.common.ResultList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.ruoyi.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/backend/shopping/shoppingCart")
public class ShoppingCartController {
    @Autowired
    private ShoppingCartService shoppingCartService;
    @GetMapping("/list")
    public ResultList<List<ShoppingCart>> list(Integer userId){
        startPage();
        List<ShoppingCart> shoppingCarts = shoppingCartService.selectList(userId);
        return ResultList.success(shoppingCarts, (int) new PageInfo(shoppingCarts).getTotal(),"查询成功");
    }
}
